<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/base/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/base/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/base/jqueryweui.css" />
		<link rel="stylesheet" type="text/css" href="css/base/public.css" />
	</head>
	<style type="text/css">
		.IM_top {
			height: 50px;
			width: 100%;
			position: fixed;
			top: 0px;
		}
		
		.IM_content {
			margin: 50px 0px;
		}
		
		.IM_top_txt {
			color: white;
			font-weight: bolder;
			font-family: "微软雅黑";
			font-size: 20px;
			line-height: 50px;
			margin-left: 20px;
		}
		
		.IM_content_people {
			border-bottom: 1px solid #eee;
			box-shadow: 0px 1px 3px #eee;
			height: 50px;
			-webkit-box-align: center;
			display: -webkit-box;
		}
		
		.IM_content_people:active {
			background: #F5F5F5;
		}
		
		.IM_content_peopleImg {
			background: #666;
			width: 30px;
			height: 30px;
			margin: 0px 20px;
		}
		
		.IM_content_peopleName {
			height: 30px;
			margin-right: 20px;
			-webkit-box-flex: 1;
			text-align: center;
		}
		
		.xiaoxiIcon {
			border: 1px solid;
			font-size: 22px;
			border-radius: 50px;
			padding: 0px 7px 0px 7px;
			background-color: #13A311;
			color: white;
		}
	</style>

	<body>
		<!--
        	作者：530929822@qq.com
        	时间：2017-03-29
        	描述：私信聊天页
        -->
		<!--顶部开始-->
		<div class="IM_top top_blue">
			<span class="IM_top_txt">消息</span>
		</div>
		<!--顶部结束-->
		<!--内容开始-->
		<div class="IM_content">
			<a class="weui-cell weui-cell_access" v-on:click="tiaozhuan(this)" v-for="item in list">
				<div class="Hui-iconfont Hui-iconfont-xiaoxi1 font_color6 m_right10 xiaoxiIcon"></div>
				<div class="weui-cell__bd weui-cell_primary">
					<p class="font-size14 font_color3">报修时间：<span v-html="item.createdAt"></span></p>
					<p class="font-size9 font_color6">报修审核通过，本单已为您免费</p>
				</div>
				<span class="weui-cell__ft"></span>
			</a>
		</div>
		<!--内容结束-->
		<!--底部按钮开始-->
		<div class="weui-tabbar footer">
			<a href="index.html" class="weui-tabbar__item ">
				<p style="" class=" weui-tabbar__label Hui-iconfont Hui-iconfont-saoyisao "></p>
			</a>
			<a href="IM.html " class="weui-tabbar__item ">
				<p class="footertab_blue weui-tabbar__label Hui-iconfont Hui-iconfont-xiaoxi1 "></p>
			</a>
			<a href="personal.html " class="weui-tabbar__item ">
				<p class="weui-tabbar__label Hui-iconfont Hui-iconfont-user "></p>
			</a>
		</div>
		<!--底部按钮结束-->
	</body>
	<script src="js/base/av-min-2.1.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/base/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/base/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/base/vue.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		window.onload = function() {
			var APP_ID = 'hN1kSQf2DQ9awcJmwEmIIdVo-gzGzoHsz';
			var APP_KEY = 'aHCVjhhcyeerTEsKObkGSyd6';
			AV.init({
				appId: APP_ID,
				appKey: APP_KEY
			});
			var query = new AV.Query('bike_repair');
			query.find().then(function(results) {
				console.log(results[0].createdAt)
				var data=new Date(results[0].createdAt).toLocaleString()
				console.log(data)
				var email = sessionStorage.getItem("email");
				for (var i = 0; i < results.length; i++) {
					if (email=results[i].attributes.email) {
						obj = {
						id: results[i].id,
						email: results[i].attributes.email,
						faultType: results[i].attributes.faultType,
						beizhu: results[i].attributes.beizhu,
						bikeNumber: results[i].attributes.bikeNumber,
						createdAt: new Date(results[i].createdAt).toLocaleString()
					}
					vue.list.push(obj)
					}
					
				}
				// 如果这样写，第二个条件将覆盖第一个条件，查询只会返回 priority = 1 的结果
			}, function(error) {});
		}
		var vue = new Vue({
				el: "body",
				data: {
					list: []
				},
				methods: {
					remove: function(index) {
						console.log(index.item);
						var todo = AV.Object.createWithoutData('user_info', index.item.id);
						todo.destroy().then(function(success) {
							// 删除成功
							alert("删除成功")
						}, function(error) {
							// 删除失败
						});
					},
					tiaozhuan:function  (obj) {
						var beizhu=obj.item.beizhu;
						var bikeNumber=obj.item.bikeNumber;
						var faultType=obj.item.faultType;
						var createdAt=obj.item.createdAt;
						sessionStorage.setItem("报修备注",obj.item.beizhu);
						sessionStorage.setItem("报修车辆号",obj.item.bikeNumber);
						sessionStorage.setItem("报修类型",obj.item.faultType);
						sessionStorage.setItem("报修时间",obj.item.createdAt);
						location.href="repairInfo.html";
					}
				}
			})
	</script>

</html>